
<h1><span class="yiyi-st" id="yiyi-12">numpy.ndarray</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="class">
<dt id="numpy.ndarray"><span class="yiyi-st" id="yiyi-13"> <em class="property">class </em><code class="descclassname">numpy.</code><code class="descname">ndarray</code><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/__init__.py"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">数组对象表示固定大小项目的多维均匀数组。</span><span class="yiyi-st" id="yiyi-15">相关联的数据类型对象描述了数组中每个元素的格式（其字节顺序，它在内存中占用的字节数，是整数，浮点数还是其他值等）</span></p>
<p><span class="yiyi-st" id="yiyi-16">数组应使用<a class="reference internal" href="numpy.array.html#numpy.array" title="numpy.array"><code class="xref py py-obj docutils literal"><span class="pre">array</span></code></a>，<a class="reference internal" href="numpy.zeros.html#numpy.zeros" title="numpy.zeros"><code class="xref py py-obj docutils literal"><span class="pre">zeros</span></code></a>或<a class="reference internal" href="numpy.empty.html#numpy.empty" title="numpy.empty"><code class="xref py py-obj docutils literal"><span class="pre">empty</span></code></a>（请参阅下面的“另请参阅”部分）来构造。</span><span class="yiyi-st" id="yiyi-17">这里给出的参数指的是用于实例化数组的低级方法（<em class="xref py py-obj">ndarray（...）</em>）。</span></p>
<p><span class="yiyi-st" id="yiyi-18">有关更多信息，请参阅<a class="reference internal" href="../index.html#module-numpy" title="numpy"><code class="xref py py-obj docutils literal"><span class="pre">numpy</span></code></a>模块并检查数组的方法和属性。</span></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name">
<col class="field-body">
<tbody valign="top">
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-19">参数：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-20"><strong>（用于__new__方法；请参见下面的注释）</strong></span></p>
<p><span class="yiyi-st" id="yiyi-21"><strong>shape</strong>：ints的元组</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-22">已创建数组的形状。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-23"><strong>dtype</strong>：数据类型，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-24">可以解释为numpy数据类型的任何对象。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-25"><strong>buffer</strong>：对象暴露缓冲区接口，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-26">用于用数据填充数组。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-27"><strong>offset</strong>：int，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-28">缓冲器中数组数据的偏移量。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-29"><strong>strides</strong>：ints的tuple，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-30">内存中的数据步长。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-31"><strong>order</strong>：{&apos;C&apos;，&apos;F&apos;}，可选</span></p>
<blockquote class="last">
<div><p><span class="yiyi-st" id="yiyi-32">行主（C风格）或列主（Fortran风格）顺序。</span></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title"><span class="yiyi-st" id="yiyi-33">也可以看看</span></p>
<dl class="last docutils">
<dt><span class="yiyi-st" id="yiyi-34"><a class="reference internal" href="numpy.array.html#numpy.array" title="numpy.array"><code class="xref py py-obj docutils literal"><span class="pre">array</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-35">构造数组。</span></dd>
<dt><span class="yiyi-st" id="yiyi-36"><a class="reference internal" href="numpy.zeros.html#numpy.zeros" title="numpy.zeros"><code class="xref py py-obj docutils literal"><span class="pre">zeros</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-37">创建一个数组，其每个元素为零。</span></dd>
<dt><span class="yiyi-st" id="yiyi-38"><a class="reference internal" href="numpy.empty.html#numpy.empty" title="numpy.empty"><code class="xref py py-obj docutils literal"><span class="pre">empty</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-39">创建一个数组，但保留其分配的内存不变（即，它包含“垃圾”）。</span></dd>
<dt><span class="yiyi-st" id="yiyi-40"><a class="reference internal" href="numpy.dtype.html#numpy.dtype" title="numpy.dtype"><code class="xref py py-obj docutils literal"><span class="pre">dtype</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-41">创建数据类型。</span></dd>
</dl>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-42">笔记</span></p>
<p><span class="yiyi-st" id="yiyi-43">有两种使用<code class="docutils literal"><span class="pre">__new__</span></code>创建数组的模式：</span></p>
<ol class="arabic simple">
<li><span class="yiyi-st" id="yiyi-44">如果<em class="xref py py-obj">buffer</em>为None，则只使用<a class="reference internal" href="numpy.ndarray.shape.html#numpy.ndarray.shape" title="numpy.ndarray.shape"><code class="xref py py-obj docutils literal"><span class="pre">shape</span></code></a>，<a class="reference internal" href="numpy.dtype.html#numpy.dtype" title="numpy.dtype"><code class="xref py py-obj docutils literal"><span class="pre">dtype</span></code></a>和<em class="xref py py-obj">order</em>。</span></li>
<li><span class="yiyi-st" id="yiyi-45">如果<em class="xref py py-obj">buffer</em>是暴露缓冲区接口的对象，则解释所有关键字。</span></li>
</ol>
<p><span class="yiyi-st" id="yiyi-46">不需要<code class="docutils literal"><span class="pre">__init__</span></code>方法，因为数组在<code class="docutils literal"><span class="pre">__new__</span></code>方法后完全初始化。</span></p>
<p class="rubric"><span class="yiyi-st" id="yiyi-47">例子</span></p>
<p><span class="yiyi-st" id="yiyi-48">这些示例说明了低级<a class="reference internal" href="#numpy.ndarray" title="numpy.ndarray"><code class="xref py py-obj docutils literal"><span class="pre">ndarray</span></code></a>构造函数。</span><span class="yiyi-st" id="yiyi-49">请参阅上面的<em class="xref py py-obj">请参阅</em>部分，以了解更容易构建ndarray的方法。</span></p>
<p><span class="yiyi-st" id="yiyi-50">第一种模式，<em class="xref py py-obj">缓冲</em>为无：</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">float</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="s1">&apos;F&apos;</span><span class="p">)</span>
<span class="go">array([[ -1.13698227e+002,   4.25087011e-303],</span>
<span class="go">       [  2.88528414e-306,   3.27025015e-309]])         #random</span>
</pre></div>
</div>
<p><span class="yiyi-st" id="yiyi-51">第二模式：</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">((</span><span class="mi">2</span><span class="p">,),</span> <span class="n">buffer</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">]),</span>
<span class="gp">... </span>           <span class="n">offset</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">int_</span><span class="p">()</span><span class="o">.</span><span class="n">itemsize</span><span class="p">,</span>
<span class="gp">... </span>           <span class="n">dtype</span><span class="o">=</span><span class="nb">int</span><span class="p">)</span> <span class="c1"># offset = 1*itemsize, i.e. skip first element</span>
<span class="go">array([2, 3])</span>
</pre></div>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-52">属性</span></p>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%">
<col width="90%">
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-53"><a class="reference internal" href="numpy.ndarray.T.html#numpy.ndarray.T" title="numpy.ndarray.T"><code class="xref py py-obj docutils literal"><span class="pre">T</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-54">与self.transpose()相同，除非self是self.ndim返回</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-55"><a class="reference internal" href="numpy.ndarray.data.html#numpy.ndarray.data" title="numpy.ndarray.data"><code class="xref py py-obj docutils literal"><span class="pre">data</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-56">Python缓冲区对象指向数组的数据的开始。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-57"><a class="reference internal" href="numpy.ndarray.dtype.html#numpy.ndarray.dtype" title="numpy.ndarray.dtype"><code class="xref py py-obj docutils literal"><span class="pre">dtype</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-58">数组元素的数据类型。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-59"><a class="reference internal" href="numpy.ndarray.flags.html#numpy.ndarray.flags" title="numpy.ndarray.flags"><code class="xref py py-obj docutils literal"><span class="pre">flags</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-60">有关数组的内存布局的信息。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-61"><a class="reference internal" href="numpy.ndarray.flat.html#numpy.ndarray.flat" title="numpy.ndarray.flat"><code class="xref py py-obj docutils literal"><span class="pre">flat</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-62">数组上的1-D迭代器。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-63"><a class="reference internal" href="numpy.ndarray.imag.html#numpy.ndarray.imag" title="numpy.ndarray.imag"><code class="xref py py-obj docutils literal"><span class="pre">imag</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-64">数组的虚部。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-65"><a class="reference internal" href="numpy.ndarray.real.html#numpy.ndarray.real" title="numpy.ndarray.real"><code class="xref py py-obj docutils literal"><span class="pre">real</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-66">数组的实数部分（对应虚数的概念）</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-67"><a class="reference internal" href="numpy.ndarray.size.html#numpy.ndarray.size" title="numpy.ndarray.size"><code class="xref py py-obj docutils literal"><span class="pre">size</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-68">数组中的元素数。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-69"><a class="reference internal" href="numpy.ndarray.itemsize.html#numpy.ndarray.itemsize" title="numpy.ndarray.itemsize"><code class="xref py py-obj docutils literal"><span class="pre">itemsize</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-70">一个数组元素的长度（以字节为单位）。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-71"><a class="reference internal" href="numpy.ndarray.nbytes.html#numpy.ndarray.nbytes" title="numpy.ndarray.nbytes"><code class="xref py py-obj docutils literal"><span class="pre">nbytes</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-72">数组的元素消耗的总字节数。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-73"><a class="reference internal" href="numpy.ndarray.ndim.html#numpy.ndarray.ndim" title="numpy.ndarray.ndim"><code class="xref py py-obj docutils literal"><span class="pre">ndim</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-74">数组尺寸数。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-75"><a class="reference internal" href="numpy.ndarray.shape.html#numpy.ndarray.shape" title="numpy.ndarray.shape"><code class="xref py py-obj docutils literal"><span class="pre">shape</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-76">数组维数组。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-77"><a class="reference internal" href="numpy.ndarray.strides.html#numpy.ndarray.strides" title="numpy.ndarray.strides"><code class="xref py py-obj docutils literal"><span class="pre">strides</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-78">遍历数组时，在每个维度中步进的字节数组。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-79"><a class="reference internal" href="numpy.ndarray.ctypes.html#numpy.ndarray.ctypes" title="numpy.ndarray.ctypes"><code class="xref py py-obj docutils literal"><span class="pre">ctypes</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-80">一个对象，用于简化数组与ctypes模块的交互。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-81"><a class="reference internal" href="numpy.ndarray.base.html#numpy.ndarray.base" title="numpy.ndarray.base"><code class="xref py py-obj docutils literal"><span class="pre">base</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-82">如果内存是来自某个其他对象的基本对象。</span></td>
</tr>
</tbody>
</table>
<p class="rubric"><span class="yiyi-st" id="yiyi-83">方法</span></p>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%">
<col width="90%">
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-84"><a class="reference internal" href="numpy.ndarray.all.html#numpy.ndarray.all" title="numpy.ndarray.all"><code class="xref py py-obj docutils literal"><span class="pre">all</span></code></a>（[axis，out，keepdims]）</span></td>
<td><span class="yiyi-st" id="yiyi-85">如果所有元素均为True，则返回True。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-86"><a class="reference internal" href="numpy.ndarray.any.html#numpy.ndarray.any" title="numpy.ndarray.any"><code class="xref py py-obj docutils literal"><span class="pre">any</span></code></a>（[axis，out，keepdims]）</span></td>
<td><span class="yiyi-st" id="yiyi-87">如果<em class="xref py py-obj">a</em>的任何元素求值为True，则返回True。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-88"><a class="reference internal" href="numpy.ndarray.argmax.html#numpy.ndarray.argmax" title="numpy.ndarray.argmax"><code class="xref py py-obj docutils literal"><span class="pre">argmax</span></code></a>（[axis，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-89">沿给定轴的最大值的返回指数。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-90"><a class="reference internal" href="numpy.ndarray.argmin.html#numpy.ndarray.argmin" title="numpy.ndarray.argmin"><code class="xref py py-obj docutils literal"><span class="pre">argmin</span></code></a>（[axis，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-91">沿着<em class="xref py py-obj">a</em>的给定轴的最小值的返回指数。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-92"><a class="reference internal" href="numpy.ndarray.argpartition.html#numpy.ndarray.argpartition" title="numpy.ndarray.argpartition"><code class="xref py py-obj docutils literal"><span class="pre">argpartition</span></code></a>（kth [，axis，kind，order]）</span></td>
<td><span class="yiyi-st" id="yiyi-93">返回将对此数组进行分区的索引。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-94"><a class="reference internal" href="numpy.ndarray.argsort.html#numpy.ndarray.argsort" title="numpy.ndarray.argsort"><code class="xref py py-obj docutils literal"><span class="pre">argsort</span></code></a>（[axis，kind，order]）</span></td>
<td><span class="yiyi-st" id="yiyi-95">返回将此数组排序的索引。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-96"><a class="reference internal" href="numpy.ndarray.astype.html#numpy.ndarray.astype" title="numpy.ndarray.astype"><code class="xref py py-obj docutils literal"><span class="pre">astype</span></code></a>（dtype [，order，casting，subok，copy]）</span></td>
<td><span class="yiyi-st" id="yiyi-97">数组的复制，强制转换为指定的类型。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-98"><a class="reference internal" href="numpy.ndarray.byteswap.html#numpy.ndarray.byteswap" title="numpy.ndarray.byteswap"><code class="xref py py-obj docutils literal"><span class="pre">byteswap</span></code></a>（inplace）</span></td>
<td><span class="yiyi-st" id="yiyi-99">交换数组元素的字节</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-100"><a class="reference internal" href="numpy.ndarray.choose.html#numpy.ndarray.choose" title="numpy.ndarray.choose"><code class="xref py py-obj docutils literal"><span class="pre">choose</span></code></a>（choices [，out，mode]）</span></td>
<td><span class="yiyi-st" id="yiyi-101">使用索引数组从一组选择中构造新的数组。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-102"><a class="reference internal" href="numpy.ndarray.clip.html#numpy.ndarray.clip" title="numpy.ndarray.clip"><code class="xref py py-obj docutils literal"><span class="pre">clip</span></code></a>（[min，max，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-103">返回值限于<code class="docutils literal"><span class="pre">[min，</span> <span class="pre">max]</span></code>的数组。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-104"><a class="reference internal" href="numpy.ndarray.compress.html#numpy.ndarray.compress" title="numpy.ndarray.compress"><code class="xref py py-obj docutils literal"><span class="pre">compress</span></code></a>（condition [，axis，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-105">沿给定轴返回此数组的所选切片。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-106"><a class="reference internal" href="numpy.ndarray.conj.html#numpy.ndarray.conj" title="numpy.ndarray.conj"><code class="xref py py-obj docutils literal"><span class="pre">conj</span></code></a>()</span></td>
<td><span class="yiyi-st" id="yiyi-107">复共轭所有元素。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-108"><a class="reference internal" href="numpy.ndarray.conjugate.html#numpy.ndarray.conjugate" title="numpy.ndarray.conjugate"><code class="xref py py-obj docutils literal"><span class="pre">conjugate</span></code></a>()</span></td>
<td><span class="yiyi-st" id="yiyi-109">按元素方式返回复共轭。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-110"><a class="reference internal" href="numpy.ndarray.copy.html#numpy.ndarray.copy" title="numpy.ndarray.copy"><code class="xref py py-obj docutils literal"><span class="pre">copy</span></code></a>（[order]）</span></td>
<td><span class="yiyi-st" id="yiyi-111">返回数组的副本。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-112"><a class="reference internal" href="numpy.ndarray.cumprod.html#numpy.ndarray.cumprod" title="numpy.ndarray.cumprod"><code class="xref py py-obj docutils literal"><span class="pre">cumprod</span></code></a>（[axis，dtype，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-113">返回沿给定轴的元素的累积乘积。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-114"><a class="reference internal" href="numpy.ndarray.cumsum.html#numpy.ndarray.cumsum" title="numpy.ndarray.cumsum"><code class="xref py py-obj docutils literal"><span class="pre">cumsum</span></code></a>（[axis，dtype，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-115">返回沿给定轴的元素的累积和。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-116"><a class="reference internal" href="numpy.ndarray.diagonal.html#numpy.ndarray.diagonal" title="numpy.ndarray.diagonal"><code class="xref py py-obj docutils literal"><span class="pre">diagonal</span></code></a>（[offset，axis1，axis2]）</span></td>
<td><span class="yiyi-st" id="yiyi-117">返回指定的对角线。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-118"><a class="reference internal" href="numpy.ndarray.dot.html#numpy.ndarray.dot" title="numpy.ndarray.dot"><code class="xref py py-obj docutils literal"><span class="pre">dot</span></code></a>（b [，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-119">两个数组的点积。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-120"><a class="reference internal" href="numpy.ndarray.dump.html#numpy.ndarray.dump" title="numpy.ndarray.dump"><code class="xref py py-obj docutils literal"><span class="pre">dump</span></code></a>（file）</span></td>
<td><span class="yiyi-st" id="yiyi-121">将数组的pickle转储到指定的文件。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-122"><a class="reference internal" href="numpy.ndarray.dumps.html#numpy.ndarray.dumps" title="numpy.ndarray.dumps"><code class="xref py py-obj docutils literal"><span class="pre">dumps</span></code></a>()</span></td>
<td><span class="yiyi-st" id="yiyi-123">以字符串形式返回数组的pickle。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-124"><a class="reference internal" href="numpy.ndarray.fill.html#numpy.ndarray.fill" title="numpy.ndarray.fill"><code class="xref py py-obj docutils literal"><span class="pre">fill</span></code></a>（value）</span></td>
<td><span class="yiyi-st" id="yiyi-125">使用标量值填充数组。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-126"><a class="reference internal" href="numpy.ndarray.flatten.html#numpy.ndarray.flatten" title="numpy.ndarray.flatten"><code class="xref py py-obj docutils literal"><span class="pre">flatten</span></code></a>（[order]）</span></td>
<td><span class="yiyi-st" id="yiyi-127">将折叠的数组的副本返回到一个维度。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-128"><a class="reference internal" href="numpy.ndarray.getfield.html#numpy.ndarray.getfield" title="numpy.ndarray.getfield"><code class="xref py py-obj docutils literal"><span class="pre">getfield</span></code></a>（dtype [，offset]）</span></td>
<td><span class="yiyi-st" id="yiyi-129">将给定数组的字段返回为特定类型。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-130"><a class="reference internal" href="numpy.ndarray.item.html#numpy.ndarray.item" title="numpy.ndarray.item"><code class="xref py py-obj docutils literal"><span class="pre">item</span></code></a>（\ * args）</span></td>
<td><span class="yiyi-st" id="yiyi-131">将数组的元素复制到标准Python标量并返回。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-132"><a class="reference internal" href="numpy.ndarray.itemset.html#numpy.ndarray.itemset" title="numpy.ndarray.itemset"><code class="xref py py-obj docutils literal"><span class="pre">itemset</span></code></a>（\ * args）</span></td>
<td><span class="yiyi-st" id="yiyi-133">将标量插入到数组中（如果可能，将标量转换为数组的dtype）</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-134"><a class="reference internal" href="numpy.ndarray.max.html#numpy.ndarray.max" title="numpy.ndarray.max"><code class="xref py py-obj docutils literal"><span class="pre">max</span></code></a>（[axis，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-135">沿给定轴返回最大值。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-136"><a class="reference internal" href="numpy.ndarray.mean.html#numpy.ndarray.mean" title="numpy.ndarray.mean"><code class="xref py py-obj docutils literal"><span class="pre">mean</span></code></a>（[axis，dtype，out，keepdims]）</span></td>
<td><span class="yiyi-st" id="yiyi-137">返回沿给定轴的数组元素的平均值。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-138"><a class="reference internal" href="numpy.ndarray.min.html#numpy.ndarray.min" title="numpy.ndarray.min"><code class="xref py py-obj docutils literal"><span class="pre">min</span></code></a>（[axis，out，keepdims]）</span></td>
<td><span class="yiyi-st" id="yiyi-139">沿给定轴返回最小值。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-140"><a class="reference internal" href="numpy.ndarray.newbyteorder.html#numpy.ndarray.newbyteorder" title="numpy.ndarray.newbyteorder"><code class="xref py py-obj docutils literal"><span class="pre">newbyteorder</span></code></a>（[new_order]）</span></td>
<td><span class="yiyi-st" id="yiyi-141">返回具有以不同字节顺序查看的相同数据的数组。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-142"><a class="reference internal" href="numpy.ndarray.nonzero.html#numpy.ndarray.nonzero" title="numpy.ndarray.nonzero"><code class="xref py py-obj docutils literal"><span class="pre">nonzero</span></code></a>()</span></td>
<td><span class="yiyi-st" id="yiyi-143">返回非零元素的索引。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-144"><a class="reference internal" href="numpy.ndarray.partition.html#numpy.ndarray.partition" title="numpy.ndarray.partition"><code class="xref py py-obj docutils literal"><span class="pre">partition</span></code></a>（kth [，axis，kind，order]）</span></td>
<td><span class="yiyi-st" id="yiyi-145">重新排列数组中的元素，使得第k个位置的元素的值在排序数组中的位置。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-146"><a class="reference internal" href="numpy.ndarray.prod.html#numpy.ndarray.prod" title="numpy.ndarray.prod"><code class="xref py py-obj docutils literal"><span class="pre">prod</span></code></a>（[axis，dtype，out，keepdims]）</span></td>
<td><span class="yiyi-st" id="yiyi-147">返回给定轴上的数组元素的乘积</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-148"><a class="reference internal" href="numpy.ndarray.ptp.html#numpy.ndarray.ptp" title="numpy.ndarray.ptp"><code class="xref py py-obj docutils literal"><span class="pre">ptp</span></code></a>（[axis，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-149">沿给定轴的峰到峰（最大 - 最小）值。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-150"><a class="reference internal" href="numpy.ndarray.put.html#numpy.ndarray.put" title="numpy.ndarray.put"><code class="xref py py-obj docutils literal"><span class="pre">put</span></code></a>（indices，values [，mode]）</span></td>
<td><span class="yiyi-st" id="yiyi-151">对于所有<em class="xref py py-obj">n</em>，设置<code class="docutils literal"><span class="pre">a.flat [n]</span> <span class="pre">=</span> <span class="pre">在指数。</span></code></span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-152"><a class="reference internal" href="numpy.ndarray.ravel.html#numpy.ndarray.ravel" title="numpy.ndarray.ravel"><code class="xref py py-obj docutils literal"><span class="pre">ravel</span></code></a>（[order]）</span></td>
<td><span class="yiyi-st" id="yiyi-153">返回展平的数组。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-154"><a class="reference internal" href="numpy.ndarray.repeat.html#numpy.ndarray.repeat" title="numpy.ndarray.repeat"><code class="xref py py-obj docutils literal"><span class="pre">repeat</span></code></a>（重复[，轴]）</span></td>
<td><span class="yiyi-st" id="yiyi-155">重复数组的元素。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-156"><a class="reference internal" href="numpy.ndarray.reshape.html#numpy.ndarray.reshape" title="numpy.ndarray.reshape"><code class="xref py py-obj docutils literal"><span class="pre">reshape</span></code></a>（shape [，order]）</span></td>
<td><span class="yiyi-st" id="yiyi-157">返回包含具有新形状的相同数据的数组。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-158"><a class="reference internal" href="numpy.ndarray.resize.html#numpy.ndarray.resize" title="numpy.ndarray.resize"><code class="xref py py-obj docutils literal"><span class="pre">resize</span></code></a>（new_shape [，refcheck]）</span></td>
<td><span class="yiyi-st" id="yiyi-159">就地更改数组的形状和大小。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-160"><a class="reference internal" href="numpy.ndarray.round.html#numpy.ndarray.round" title="numpy.ndarray.round"><code class="xref py py-obj docutils literal"><span class="pre">round</span></code></a>（[小数，输出]）</span></td>
<td><span class="yiyi-st" id="yiyi-161">返回<em class="xref py py-obj">a</em>，每个元素四舍五入为给定的小数位数。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-162"><a class="reference internal" href="numpy.ndarray.searchsorted.html#numpy.ndarray.searchsorted" title="numpy.ndarray.searchsorted"><code class="xref py py-obj docutils literal"><span class="pre">searchsorted</span></code></a>（v [，side，sorter]）</span></td>
<td><span class="yiyi-st" id="yiyi-163">查找索引，其中v的元素应插入到a以维持顺序。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-164"><a class="reference internal" href="numpy.ndarray.setfield.html#numpy.ndarray.setfield" title="numpy.ndarray.setfield"><code class="xref py py-obj docutils literal"><span class="pre">setfield</span></code></a></span></td>
<td><span class="yiyi-st" id="yiyi-165">将值放入由数据类型定义的字段中的指定位置。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-166"><a class="reference internal" href="numpy.ndarray.setflags.html#numpy.ndarray.setflags" title="numpy.ndarray.setflags"><code class="xref py py-obj docutils literal"><span class="pre">setflags</span></code></a>（[write，align，uic]）</span></td>
<td><span class="yiyi-st" id="yiyi-167">分别设置数组标志WRITEABLE，ALIGNED和UPDATEIFCOPY。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-168"><a class="reference internal" href="numpy.ndarray.sort.html#numpy.ndarray.sort" title="numpy.ndarray.sort"><code class="xref py py-obj docutils literal"><span class="pre">sort</span></code></a>（[axis，kind，order]）</span></td>
<td><span class="yiyi-st" id="yiyi-169">就地对数组进行排序。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-170"><a class="reference internal" href="numpy.ndarray.squeeze.html#numpy.ndarray.squeeze" title="numpy.ndarray.squeeze"><code class="xref py py-obj docutils literal"><span class="pre">squeeze</span></code></a>（[axis]）</span></td>
<td><span class="yiyi-st" id="yiyi-171">从<em class="xref py py-obj">a形状删除单维条目</em>。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-172"><a class="reference internal" href="numpy.ndarray.std.html#numpy.ndarray.std" title="numpy.ndarray.std"><code class="xref py py-obj docutils literal"><span class="pre">std</span></code></a>（[axis，dtype，out，ddof，keepdims]）</span></td>
<td><span class="yiyi-st" id="yiyi-173">返回给定轴上的数组元素的标准偏差。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-174"><a class="reference internal" href="numpy.ndarray.sum.html#numpy.ndarray.sum" title="numpy.ndarray.sum"><code class="xref py py-obj docutils literal"><span class="pre">sum</span></code></a>（[axis，dtype，out，keepdims]）</span></td>
<td><span class="yiyi-st" id="yiyi-175">返回给定轴上的数组元素的总和。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-176"><a class="reference internal" href="numpy.ndarray.swapaxes.html#numpy.ndarray.swapaxes" title="numpy.ndarray.swapaxes"><code class="xref py py-obj docutils literal"><span class="pre">swapaxes</span></code></a>（axis1，axis2）</span></td>
<td><span class="yiyi-st" id="yiyi-177">返回数组的视图，其中<em class="xref py py-obj">axis1</em>和<em class="xref py py-obj">axis2</em>互换。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-178"><a class="reference internal" href="numpy.ndarray.take.html#numpy.ndarray.take" title="numpy.ndarray.take"><code class="xref py py-obj docutils literal"><span class="pre">take</span></code></a>（indices [，axis，out，mode]）</span></td>
<td><span class="yiyi-st" id="yiyi-179">返回由给定索引处的<em class="xref py py-obj">a</em>元素组成的数组。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-180"><a class="reference internal" href="numpy.ndarray.tobytes.html#numpy.ndarray.tobytes" title="numpy.ndarray.tobytes"><code class="xref py py-obj docutils literal"><span class="pre">tobytes</span></code></a>（[order]）</span></td>
<td><span class="yiyi-st" id="yiyi-181">在数组中构造包含原始数据字节的Python字节。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-182"><a class="reference internal" href="numpy.ndarray.tofile.html#numpy.ndarray.tofile" title="numpy.ndarray.tofile"><code class="xref py py-obj docutils literal"><span class="pre">tofile</span></code></a>（fid [，sep，format]）</span></td>
<td><span class="yiyi-st" id="yiyi-183">将数组作为文本或二进制（默认）写入文件。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-184"><a class="reference internal" href="numpy.ndarray.tolist.html#numpy.ndarray.tolist" title="numpy.ndarray.tolist"><code class="xref py py-obj docutils literal"><span class="pre">tolist</span></code></a>()</span></td>
<td><span class="yiyi-st" id="yiyi-185">将数组返回为（可能是嵌套的）列表。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-186"><a class="reference internal" href="numpy.ndarray.tostring.html#numpy.ndarray.tostring" title="numpy.ndarray.tostring"><code class="xref py py-obj docutils literal"><span class="pre">tostring</span></code></a>（[order]）</span></td>
<td><span class="yiyi-st" id="yiyi-187">在数组中构造包含原始数据字节的Python字节。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-188"><a class="reference internal" href="numpy.ndarray.trace.html#numpy.ndarray.trace" title="numpy.ndarray.trace"><code class="xref py py-obj docutils literal"><span class="pre">trace</span></code></a>（[offset，axis1，axis2，dtype，out]）</span></td>
<td><span class="yiyi-st" id="yiyi-189">沿数组的对角线返回总和。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-190"><a class="reference internal" href="numpy.ndarray.transpose.html#numpy.ndarray.transpose" title="numpy.ndarray.transpose"><code class="xref py py-obj docutils literal"><span class="pre">transpose</span></code></a>（\ * axes）</span></td>
<td><span class="yiyi-st" id="yiyi-191">返回具有轴转置的数组的视图。</span></td>
</tr>
<tr class="row-odd"><td><span class="yiyi-st" id="yiyi-192"><a class="reference internal" href="numpy.ndarray.var.html#numpy.ndarray.var" title="numpy.ndarray.var"><code class="xref py py-obj docutils literal"><span class="pre">var</span></code></a>（[axis，dtype，out，ddof，keepdims]）</span></td>
<td><span class="yiyi-st" id="yiyi-193">沿给定轴返回数组元素的方差。</span></td>
</tr>
<tr class="row-even"><td><span class="yiyi-st" id="yiyi-194"><a class="reference internal" href="numpy.ndarray.view.html#numpy.ndarray.view" title="numpy.ndarray.view"><code class="xref py py-obj docutils literal"><span class="pre">view</span></code></a>（[dtype，type]）</span></td>
<td><span class="yiyi-st" id="yiyi-195">数组的新视图与相同的数据。</span></td>
</tr>
</tbody>
</table>
</dd></dl>
